package com.zeng.createmd.restfulmodule.controller;

import com.zeng.createmd.restfulmodule.itemCache.ItemCache;
import com.zeng.createmd.restfulmodule.util.ItemUtil;
import com.zeng.createmd.restfulmodule.util.ProjectUtil;
import com.zeng.createmd.servicemodule.vo.ItemVo;
import com.zeng.nicecommon.util.ResponseUtil;
import com.zeng.plugin.entity.MenuView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RequestMapping
@RestController
public class MenuController {

    @Autowired
    ItemUtil itemUtil;

    @RequestMapping
    public Object add(@RequestBody MenuView menuView) {
        new ProjectUtil().putMenuView(menuView);
        return ResponseUtil.success("操作成功");
    }

    @RequestMapping
    public Object list() {
        Map<String, MenuView> menuViews = new ProjectUtil().getMenuViews();
        return ResponseUtil.success("操作成功").addData("list", menuViews.values());
    }

}
